1
|
|
|
var API = require('./API') |
2
|
|
|
var Schema = require('./Schema') |
3
|
|
|
|
4
|
|
|
module.exports = { |
5
|
|
|
API: API, |
6
|
|
|
Schema: Schema, |
7
|
|
|
TriggerType: Schema.TriggerType, |
8
|
|
|
Framework: API.Framework, |
9
|
|
|
Utility: require('./Utility'), |
10
|
|
|
/** |
11
|
|
|
* Runs provided scenario |
12
|
|
|
* |
13
|
|
|
* @param {TScenarioInput} scenario |
14
|
|
|
* @param {TFrameworkOptions} options |
15
|
|
|
* |
16
|
|
|
* @return {Thenable.<TRunResult>} |
17
|
|
|
*/ |
18
|
|
|
run: function (scenario, options) { |
19
|
|
|
return (new API.Framework(options)).run(scenario) |
20
|
|
|
}, |
21
|
|
|
/** |
22
|
|
|
* Prepares run, but doesn't execute it |
23
|
|
|
* |
24
|
|
|
* @param {TScenarioInput} scenario |
25
|
|
|
* @param {TFrameworkOptions} options |
26
|
|
|
* @return {Run} |
27
|
|
|
*/ |
28
|
|
|
prepare: function (scenario, options) { |
29
|
|
|
return (new API.Framework(options)).prepare(scenario) |
30
|
|
|
}, |
31
|
|
|
/** |
32
|
|
|
* Executes prepared Run |
33
|
|
|
* |
34
|
|
|
* @param {Run} run |
35
|
|
|
* @param {TFrameworkOptions} options |
36
|
|
|
* |
37
|
|
|
* @return {TRunResult} |
38
|
|
|
*/ |
39
|
|
|
execute: function (run, options) { |
40
|
|
|
return (new API.Framework(options)).execute(run) |
41
|
|
|
}, |
42
|
|
|
/** |
43
|
|
|
* Validates provided scenario |
44
|
|
|
* |
45
|
|
|
* @return {ViolationSet} |
46
|
|
|
*/ |
47
|
|
|
validate: Schema.Validator.scenario, |
48
|
|
|
/** |
49
|
|
|
* Normalizes provided scenario or throws an error, if scenario is |
50
|
|
|
* non-normalizable. |
51
|
|
|
* |
52
|
|
|
* @param {TScenarioInput} scenario |
53
|
|
|
* @param {TBarricadeOptions} options |
54
|
|
|
* |
55
|
|
|
* @return {TScenario} |
56
|
|
|
*/ |
57
|
|
|
barricade: function (scenario, options) { |
58
|
|
|
return (new API.Barricade(options)).scenario(scenario) |
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
|